<template>
	<view class="all">
		<navbar :backgroung="'#cff0c8'" @updateHeight="updateNavbarHeight" />
		<view class="container" :style="{ marginTop: navbarHeight + 'rpx' }">
			<view class="header">
				<!-- <view class="title">Pollen Dispersal</view> -->
				<!-- 				<view @click="navigatorTo1" class="user">
					<image class="user-icon" src="../../static/resource/yumi-image/5.jpg" mode=""></image>
					<view class="text">Personal</view>
				</view> -->
				<view @click="navigatorTo1" class="user">
					<image class="user-icon" src="../../static/resource/yumi-image/5.jpg" mode=""></image>
					<div class="text-box">
						<view class="text">Coming Soon</view>
					</div>
					<!-- <view class="text">{{ nickname }}</view> -->
				</view>

			</view>

		</view>


		<scroll-view class="scroll-container" scroll-y>
			<!-- Table Header -->
			<div class="msg" v-if="!imageResults.length">{{ msg }}</div>
			<!-- Table Content -->
			<view class="table-row" v-for="(item, index) in imageResults" :key="item.id">
				<image class="thumbnail" :src="item.thumbnail" mode="scaleToFill" />

				<!-- New 2x4 Table -->
				<table class="result-table">
					<tr class="table-header-row">
						<th class="table-header-item">Dispersal?</th>
						<th class="table-header-item">Credibility</th>
					</tr>
					<tr class="table-content-row">
						<th class="table-content-item" v-if="item.result === 'san1'">Yes</th>
						<th class="table-content-item" v-else>No</th>
						<th class="table-content-item">{{ (item.credibility * 100).toFixed(2) }}%</th>
					</tr>

				</table>
				<uni-easyinput type="textarea" class="beizhu" v-model="item.beizhu" @focus="storeOriginalRemark(item)"
					@blur="handleBlur(item)" placeholder="Edit" />

			</view>
		</scroll-view>
	</view>
</template>
<script setup>
import {
	ref,
	onMounted,
} from 'vue';
import {
	onLoad,
	onShow
} from "@dcloudio/uni-app"
const navbarHeight = ref(0);
const imageResults = ref([]); // 存储缩略图和结果
const userId = ref(null);
const token = ref(null);
const isLoading = ref(false); // 创建一个用于控制加载状态的变量
// 用于存储原始备注  
const originalRemarks = ref({});

// Callback to receive height from navbar
const updateNavbarHeight = (height) => {
	navbarHeight.value = height;
};

const navigatorTo1 = () => {
	uni.navigateTo({
		url: '/pages/user/index',
	});
};
</script>

<style lang="less">
@import '../../styles/common-styles.css';

* {}

.all {
	height: 100%;
	overflow: hidden;
	background-color: #f5f5f5;





	.user {
		position: fixed;
		top: 80rpx;
		left: 15rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 10rpx;
		// border: 3rpx solid black;
		border-radius: 20rpx;
		background-color: #cff0c8;
		// box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
		z-index: 9999;


		.user-icon {

			width: 60rpx;
			height: 60rpx;
			border-radius: 50%;
			margin-right: 80rpx;
			border: 2rpx solid #000000;
		}

		.text {
			background-color: #cff0c8;
			font-size: 36rpx;
			font-weight: bold;
			margin-left: 80rpx;
			// left: 20%;
			// transform: translate(-50%, -50%);
		}
	}


	.container {
		background-color: #f5f5f5;
		position: relative;
		width: 100%;
		height: auto;
		display: flex;
		flex-direction: column;



		.header {
			position: relative;
			display: flex;
			align-items: center;
			justify-content: center;
			// padding: 20rpx;
			background-color: #d3d3d3;
			// margin: 20rpx 0;
			// margin-bottom: 20rpx;

			.title {
				background-color: #d3d3d3;
				font-size: 36rpx; // 字体大小
				font-weight: bold; // 加粗
				text-align: center;

			}


		}

		.middle {
			position: relative;
			display: flex;
			flex-direction: column; // 纵向布局
			align-items: center; // 居中对齐
			height: 300rpx;


			/* 背景图片样式 */
			.background {
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				background-image: url('../../static/resource/yumi-image/10.jpg');

				background-size: cover;
				background-position: center;
				z-index: 0;
				/* 使其位于最底层 */
			}

			.photo-button {
				position: absolute;
				/* 定位按钮 */
				top: 50%;
				/* 垂直居中 */
				left: 50%;
				/* 水平居中 */
				transform: translate(-50%, -50%);
				/* 按钮中心对齐父容器 */
				height: 300rpx;
				/* 固定高度 */
				width: 100%;
				/* 固定宽度 */
				font-size: 100rpx;
				/* 调整加号字体大小 */
				font-weight: bold;
				color: #fff;
				background-color: rgba(0, 0, 0, 0.6);
				/* 半透明背景 */
				/* 按钮为圆形 */
				display: flex;
				justify-content: center;
				align-items: center;
				/* 确保文字居中 */
				z-index: 1;
				/* 确保按钮在背景图片上方 */
			}

		}


	}

	.scroll-container {

		background-color: #f5f5f5;
		max-height: 870rpx;
		/* 设置最大高度，确保能够滚动 */
		overflow-y: scroll;
		/* 启用垂直滚动 */
		border: 2rpx solid #ddd;
		/* 为容器添加边框 */
		// padding: 10rpx;

		/* 给容器增加内边距 */


		.table-header {
			display: flex;
			justify-content: space-between;
			align-items: center;
			/* 垂直居中对齐 */
			padding: 10rpx 20rpx;
			font-weight: bold;
			background-color: #f5f5f5;
			border-bottom: 1px solid #ddd;
			position: sticky;
			top: 0;
			z-index: 9999;

			.header-item1 {
				background-color: #f5f5f5;
				width: 25%;
				text-align: center;
			}

			.header-item2 {
				background-color: #f5f5f5;
				width: 50%;
				text-align: center;
				padding: 10rpx 0rpx;
			}

			.header-item3 {
				background-color: #f5f5f5;
				flex: 1;
				text-align: center;
			}
		}

		.table-row {
			display: flex;
			align-items: center; // 垂直居中对齐  
			justify-content: space-between; // 在行内均匀分布  
			padding: 10rpx 20rpx;
			border-bottom: 2rpx solid #cdcdcd;


			.thumbnail {
				width: 23%; // 图片占 20%  
				height: 170rpx;
				border-radius: 10rpx;
				margin-right: 10rpx;
				object-fit: contain;
			}

			.result-table {
				width: 50%; // 表格占 50%  
				font-size: 25rpx;
				height: 170rpx;
				border-collapse: collapse; // 合并边框  

				.table-header-row {
					background-color: #4CAF50; // 表头背景颜色  
					color: #fff
				}

				.table-header-item,
				.table-content-item {
					padding: 5rpx; // 单元格内边距  
					text-align: center; // 中间对齐  
					border: 1rpx solid #000; // 边框样式  
				}

				.table-content-row {
					background-color: #fff; // 表体背景颜色  
				}
			}


		}
	}
}
</style>